#ifdef _WIN32
#include "stdafx.h"
#endif
void game_machine :: error_message(err_msg m)
{
    switch(m)
    {
        case out_of_mana:
            LOGMSG("Not enough of mana !");
            break;
        case obstacle:
            LOGMSG("Can't see the target !");
            break;
        case too_far_away1:
            LOGMSG("Target is too far away !");
            break;
        case too_far_away2:
            LOGMSG("This is too far away !");
            break;
        case is_on_cooldown:
            LOGMSG("Can't do that yet !");
            break;
    }
}
int get_int_from_mask (int n, int top, int bottom)
{ return (n >> (bottom - 1)) & (0xFFFFFFFF >> (top - bottom + 1)); }
void unset_bit(int & mask, int n)
{ mask &= ~ n; }
void game_machine :: damage_msg(short emit, short target, short dmg)
{
    static string
        s_emit = CharNames[emit],
        s_target = CharNames[target],
        s_dmg = TO_STR(dmg/100.f);
    LOGMSG(s_emit+" deals "+s_dmg+" to "+s_target);
}

string game_machine :: inspect_cast(short emit, short abil, short target)
{
    return CharNames[emit] +" "+ AbilNames[abil] +" "+ CharNames[target];
}



/*void game_machine :: process_states     ()
{
	for(auto it = Timers.begin(); it != Timers.end(); ++ it)
	{
		if(it -> delay > 0.f)
			it -> delay -= timeSinceLastFrame;
		else if(AB_BASE(it->emit, it->abil).mask & HAS_COOLDOWN) // instant cast
		{
			apply_effect(it->emit, it->target, it->abil);
			availables.push(std::distance(Timers.begin(), it));
		}
		else // fired, cd is over
			availables.push(std::distance(Timers.begin(), it));
	}
}*/

// shifts right bottom times
// ANDs it with a top-times left-shifted FFF
